cmake_minimum_required(VERSION 3.10)

project(RemoteUI)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)
set(CMAKE_CXX_FLAGS "-g -Wall -Xlinker -export-dynamic")

find_package(PkgConfig REQUIRED)
find_package(fmt REQUIRED)
#find_package(Boost REQUIRED COMPONENTS program_options)
#find_package(yaml-cpp REQUIRED)
find_package(msgpack-cxx REQUIRED)
find_package(spdlog REQUIRED)
#pkg_check_modules(gstreamer REQUIRED IMPORTED_TARGET gstreamer-1.0 gstreamer-video-1.0 gstreamer-app-1.0)
pkg_check_modules(GTKMM REQUIRED IMPORTED_TARGET gtkmm-4.0)
#file(GLOB ALL_SOURCE "src/*.h" "src/*.cpp")
aux_source_directory("ProjectManagerUI" PROJECTMANAGER_SOURCE)
aux_source_directory("RealtimeUI" REALTIME_SOURCE)
aux_source_directory("common" COMMON_LIB_SOURCE)
include_directories(../include include)
link_libraries(
  PkgConfig::GTKMM 
  fmt 
  #yaml-cpp
  pthread
  spdlog::spdlog
  #  PkgConfig::gstreamer
  rt
  msgpack-cxx
  #${Boost_LIBRARIES}
  #boost_program_options
)

# add_executable(ProjectManagerUI 
#   ${PROJECTMANAGER_SOURCE} 
#   ${COMMON_LIB_SOURCE}
#   run/ProjectManager_run.cpp
# )

# add_executable(RealtimeUI
#   ${REALTIME_SOURCE}
#   ${COMMON_LIB_SOURCE}
#   run/RealTimeUI_run.cpp
# )

# add_executable(CreateProjectUI_test 
#   ProjectManagerUI/CreateProjectDialog.cpp 
#   ProjectManagerUI/CheckURLSpecialSymbol.cpp
#   test/CreateProjectDialog_test.cpp
# )
# add_executable(CreateTaskUI_test 
#   ProjectManagerUI/CreateTaskDialog.cpp 
#   ProjectManagerUI/CheckURLSpecialSymbol.cpp
#   test/CreateTaskDialog_test.cpp
# )

# add_executable(RealtimeUI_test
#   RealtimeUI/RealTimeWindow.cpp
#   test/RealTimeWindow_test.cpp
# )

# add_executable(WebsocketClient_test
#   RealtimeUI/WebsocketClient.cpp
#   test/WebsocketClient_test.cpp
# )

# add_executable(ServerControl_test
#   RealtimeUI/ServerControl.cpp
#   test/ServerControl_test.cpp
# )

# add_executable(JPEGDecomp_test
#   RealtimeUI/MPEGDecompress.cpp
#   test/MPEGDecompress_test.cpp
# )

if(BUILD_FLATPAK)
  add_compile_definitions(USE_FLATPAK)
endif()

if(BUILD_TEST)
add_executable(ControlUI_test
  test/ControlUI_test.cpp
  ControlUI/UI.cpp
)

add_executable(NetworkConnect_test
  test/NetworkConnect_test.cpp
  ControlUI/NetworkConnect.cpp
)

add_executable(RecordListReader_test
  test/RecordListReader_test.cpp
  ControlUI/RecordListReader.cpp
)
endif()
add_executable(hbty_remote_control
  run/ControlUI.cpp
  ControlUI/UI.cpp
  ControlUI/NetworkConnect.cpp
  ControlUI/RecordListReader.cpp
  ControlUI/WebsocketClient.cpp
)

install(TARGETS hbty_remote_control
  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES UI/Control.ui TYPE LIB)
